import React from 'react'
import style from './index.module.scss'
import { showTime } from '@/utils/utils'
import CommentForm from '../commentForm'
import CommentMain from '../commentMain'
interface PropsType {
  commentList: BlogCommentList[]
}
export default function Comment({ commentList }: PropsType) {
  return (
    <>
      <CommentMain />
      <CommentForm />
      <div className={style.comment}>
        {commentList.length > 0 &&
          commentList.map((el) => {
            return (
              <div className={style.comm_list} key={el.commentId}>
                <div className={style.content}>
                  <span>{el.name}: </span>
                  <br />
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  {el.content}
                </div>
                <div className={style.info}>{showTime(el.creationTime)}</div>
                {el.reply && (
                  <div className={style.reply}>
                    <span>驴弟回复: </span>
                    <br />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {el.reply}
                  </div>
                )}
              </div>
            )
          })}
      </div>
    </>
  )
}
